package com.zxc.tess4j;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

public class Application {
    public static void main(String[] args) throws TesseractException {
        Tesseract tesseract = new Tesseract();
        tesseract.setDatapath("C:\\c\\hmtt\\heima-leadnews\\tessdata");
        tesseract.setLanguage("chi_sim");
        File file = new File("C:\\c\\hmtt\\d4\\day04-自媒体文章审核\\讲义\\自媒体文章-自动审核.assets\\image-20210524161243572.png");
        String doOCR = tesseract.doOCR(file);
        System.out.println(doOCR.replaceAll("[^\\u4E00-\\u9FA5]+", "-"));
    }
}
